/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-08 15:07:44  
 * Copyright (c) 2015- joysuch-版权所有     
 */
package com.joysuch.wwyt.bp.repository;

import com.joysuch.wwyt.bp.entity.BpContractorActivitiesScope;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Map;


/**
 * BpContractorActivitiesScopeDao
 * 
 */
public interface BpContractorActivitiesScopeDao extends JpaRepository<BpContractorActivitiesScope, Long>, QuerydslPredicateExecutor<BpContractorActivitiesScope>  {
    public Page<BpContractorActivitiesScope> findAll(Specification<BpContractorActivitiesScope> spec, Pageable pageable);

    public BpContractorActivitiesScope save(BpContractorActivitiesScope bean);

    public void delete(BpContractorActivitiesScope bean);

    /**
     * 获取活动范围（区域）名称
     */
    @Query(value = "select wpa.area_name from wwyt_pod_area wpa where wpa.id = :id", nativeQuery = true)
    public String getScopeName(@Param("id") Long id);

    /**
     * 获取活动范围（区域）全部列表
     */
    @Query(value = "select wpa.id podAreaId, wpa.area_name podAreaName from wwyt_pod_area wpa;", nativeQuery = true)
    public List<Map<String, Object>> getPodAreaList();
}
